package com.hz.user.interfaces.impl;

import com.hz.base.beans.vo.QueryParams;
import com.hz.beans.user.entity.TCounselling;
import com.hz.sys.utils.IdWorker;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hz.base.beans.vo.CommonResult;
import com.hz.base.beans.vo.PageEntity;
import com.hz.beans.code.HzOperateCode;
import com.hz.common.beans.constant.DemoResult;
import com.hz.interfaces.user.inf.ITCounsellingInterface;
import com.hz.user.service.inf.ITCounsellingService;

import java.util.List;

/**
 * ITCounsellingService
 * @author liul
 * @since [0.0.1]
 * @version [0.0.1,2018年09月20日]
 */
@Service("tCounsellingInterface")
public class TCounsellingInterface implements ITCounsellingInterface{
	
	@Autowired
	private ITCounsellingService tCounsellingService;
	

	@Override
	public CommonResult<TCounselling> queryTCounselling(Long id) {
		CommonResult<TCounselling> cr = new DemoResult<>();
		cr = tCounsellingService.selectByPrimaryKey(cr,id);
		cr.setOperate(HzOperateCode.QUERY_TCOUNSELLING);
		return cr;
	}

	@Override
	public List<TCounselling> queryPayStatus(TCounselling tCounsellings) {
		return tCounsellingService.queryPayStatus(tCounsellings);
	}

	@Override
	public CommonResult<TCounselling> addTCounselling(TCounselling tCounselling) {
		CommonResult<TCounselling> cr = new DemoResult<>();
		tCounselling.setOrderNo(new IdWorker().nextId());
		cr = tCounsellingService.insert(cr, tCounselling);
		cr.setOperate(HzOperateCode.ADD_TCOUNSELLING);
		return cr;
	}
	
	@Override
	public CommonResult<PageEntity> queryForPage(QueryParams<TCounselling> queryParams) {
		CommonResult<PageEntity> cr = new DemoResult<>();
		cr = tCounsellingService.queryForPage(cr, queryParams);
		cr.setOperate(HzOperateCode.QUERY_TCOUNSELLING_PAGE);
		return cr;
	}

	@Override
	public CommonResult<List<TCounselling>> queryTCounsellingList(QueryParams<TCounselling> queryParams) {
		CommonResult<List<TCounselling>> cr = new DemoResult<>();
		cr = tCounsellingService.queryForList(cr, queryParams);
		cr.setOperate(HzOperateCode.QUERY_TCOUNSELLING_LIST);
		return cr;
	}

	@Override
	public CommonResult<TCounselling> updateTCounselling(TCounselling tCounselling) {
		CommonResult<TCounselling> cr = new DemoResult<>();
		cr = tCounsellingService.updateByPrimaryKey(cr, tCounselling);
		cr.setOperate(HzOperateCode.UPDATE_TCOUNSELLING);
		return cr;
	}

	@Override
	public CommonResult<Object> deleteTCounsellingArray(Long[] ids) {
		CommonResult<Object> cr = new DemoResult<>();
		cr = tCounsellingService.deleteObjectArray(cr, ids);
		cr.setOperate(HzOperateCode.DELETE_TCOUNSELLING);
		return cr;
	}

	@Override
	public CommonResult<TCounselling> insertSelective(TCounselling tCounselling) {
		CommonResult<TCounselling> cr = new DemoResult<>();
		cr = tCounsellingService.insertSelective(cr, tCounselling);
		cr.setOperate(HzOperateCode.INSERTSELECTIVE_TCOUNSELLING);
		return cr;
	}

	@Override
	public CommonResult<Object> deleteByList(List<TCounselling> tCounsellingList) {
		CommonResult<Object> cr = new DemoResult<>();
		cr = tCounsellingService.deleteByList(cr, tCounsellingList);
		cr.setOperate(HzOperateCode.DELETELIST_TCOUNSELLING);
		return cr;
	}

	@Override
	public CommonResult<List<TCounselling>> batchUpdate(List<TCounselling> tCounsellingList) {
		CommonResult<List<TCounselling>> cr = new DemoResult<>();
		cr = tCounsellingService.batchUpdate(cr, tCounsellingList);
		cr.setOperate(HzOperateCode.BATCHUPDATE_TCOUNSELLING);
		return cr;
	}

	@Override
	public CommonResult<List<TCounselling>> batchSave(List<TCounselling> tCounsellingList) {
		CommonResult<List<TCounselling>> cr = new DemoResult<>();
		cr = tCounsellingService.batchSave(cr, tCounsellingList);
		cr.setOperate(HzOperateCode.BATCHSAVE_TCOUNSELLING);
		return cr;
	}

}
